module.exports = function($scope, $state, $stateParams,  $modalInstance,poolcode, releasecard, canrelease,getcardtasklist){
    $scope.poolcodeinfo = { 
    	'pool_code' : poolcode
    };
    /* 分页
     * ========================================= */
    $scope.maxSize = 5;            //最多显示多少个按钮
    $scope.bigCurrentPage = 1;      //当前页码
    $scope.itemsPerPage = 5;         //每页显示几条

    $scope.canreleasecard = function(){ 
    	var para = {
            pageNo:$scope.bigCurrentPage, 
            pageSize:$scope.itemsPerPage,
            type : '1'
        };
        para = angular.extend($scope.poolcodeinfo, para);
        getcardtasklist.save(para, function(res){
    	    console.log(para); 
    		if (res.errcode !== 0) { 
    			alert(res.errmsg);
    		} else { 
    			$scope.releasecardinfo = res.data.results;
    			 $scope.bigTotalItems = res.data.totalRecord;
    			console.log(res);
    		}
    	});
    };
    $scope.canreleasecard();
    
    $scope.cardinfo = {
    	'start_card_num' : '',
      'end_card_num' : '',
      'count' : ''
    };

    $scope.ok = function () {
        
		releasecard.save($scope.cardinfo, function(res){
			    if (res.errcode !== 0) {
            alert(res.errmsg);
			    } else {
            alert('释放成功');
            $scope.canreleasecard();
			    	// $modalInstance.close();
			    }
     	});                
	};  
    

    $scope.cancel = function () {
      $modalInstance.dismiss('cancel');
    };

};